package item;

import board.BoardUtil;
import board.PatternType;
import character.MyCharacter;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import misc.Vector3i;

public class Weapon extends Item {
    protected String weaponName;
    protected WeaponType weaponType;
    protected int baseSpeed;
    protected PatternType rangePattern;
    protected int rangeSize;
    protected int baseDamage;

    public Weapon() {}

    public Weapon(MyCharacter owner) {
        this.owner = owner;
    }

    public String getWeaponName() {
	return weaponName;
    }
    public void setWeaponName(String weaponName) {
	this.weaponName = weaponName;
    }
    public WeaponType getWeaponType() {
	return weaponType;
    }
    public void setWeaponType(WeaponType weaponType) {
	this.weaponType = weaponType;
    }
    public int getBaseSpeed() {
        return baseSpeed;
    }
    public void setBaseSpeed(int baseSpeed) {
	this.baseSpeed = baseSpeed;
    }
    public PatternType getRangePattern() {
	return rangePattern;
    }
    public void setRangePattern(PatternType rangePattern) {
	this.rangePattern = rangePattern;
    }
    public int getRangeSize() {
	return rangeSize;
    }
    public void setRangeSize(int rangeSize) {
	this.rangeSize = rangeSize;
    }
    public int getBaseDamage() {
        return baseDamage;
    }
    public void setBaseDamage(int baseDamage) {
	this.baseDamage = baseDamage;
    }
    
    public Collection<Vector3i> getLocationsInRange() {
	Set<Vector3i> locationsInRange = new HashSet<Vector3i>();
	for(Vector3i occupiedLocation : owner.getOccupiedLocations())
	    locationsInRange.addAll(BoardUtil.getPatternLocations(rangePattern, rangeSize, true, occupiedLocation));
        return locationsInRange;
    }

    @Override
    public String toString() {
	return weaponName;
    }
}
